import { defineStore } from 'pinia'
import { ref } from 'vue'
export const useUserStore = defineStore('user',()=>{
		const user = ref({})
		const setUser = (val) => {
			user.value = val
		}
		const delUser = () => {
			user.value = {}
		}
		//把跳转页面和跳转方式记录在这里
		//记录跳转成功后的跳转页面地址
		const redirectURL = ref('/pages/index/index')
		//记录页面跳转的方式
		const openType = ref('switchTab')
		return {
			user,setUser,delUser,redirectURL,openType
		}
},{
	persist:{
			storage:{
				setItem:(key,val)=>{
					 uni.setStorageSync(key,val)
				},
				getItem:(key)=>{
					return uni.getStorageSync(key)
				},
			}
	}
}
)